#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int MAXN = 111;
int t, n , m;
ll x, d;

string s[MAXN];

bool is_prime(ll n) {
    for (ll i = 2; i*i <= n; i++ ) {
        if (n%i == 0) return false;
    }
    return true;
}
int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    cin >> t;
    while (t--) {
        cin >> n >> m;
        for (int i = 1 ; i <= n ; i++) {
            cin >> s[i];
            s[i] = "#" + s[i];
        }

        if (s[1][1] == '1') {
            cout << -1 << endl;
            continue;
        }

        vector<pii> l, r;
        for (int i = n; i >= 1; i--) {
            for (int j = m; j >= 1; j--) {
                if (s[i][j] == '0') continue;
                if (i == 1) {
                    l.push_back({i, j-1});
                    r.push_back({i, j});
                } else {
                    l.push_back({i-1, j});
                    r.push_back({i, j});
                }
            }
        }
        cout << l.size() << endl;
        for (int i = 0 ; i < l.size(); i++) {
            cout << l[i].first << ' ' << l[i].second << ' ' << r[i].first << ' ' << r[i].second << endl;
        }
    }
    return 0;
}